import request from "@/utils/request";

/**
 * 查看详情——查询流程模型
 * @param { string } defId -流程定义id
 */
export const detailProcessModel = defId => {
  return request({
    url: `/process/model/detailByDefId/${defId}`,
    method: "get"
  });
};

/**
 * 待办——查询流程模型
 * @param { string } formId -表单ID
 * @param { string } businessKey -业务id
 */
export const pendingProcessModel = (formId, businessKey) => {
  return request({
    url: `/process/model/detail/${formId}/${businessKey}`,
    method: "get"
  });
};

/**
 * 获取审批/待办表单模型/数据/审批记录
 * @param { string } instanceId -表单实例ID
 * @param { string } nodeId -节点ID
 */
// export const approvalForm = (instanceId, nodeId) => {
//   return request({
//     url: `/process/instance/progress/${instanceId}/${nodeId}`,
//     method: "get"
//   });
// };
export const approvalForm = (instanceId, nodeId) => {
  return request({
    url: `/process/instance/limitProgress/${instanceId}/${nodeId}`,
    method: "get"
  });
};

/**
 * 查询流程模型数据 - 据历史id 获取模型数据
 * @param { string } formHisId -流程定义id
 */
// export const processModel = formHisId => {
//   return request({
//     url: `/process/model/detailByFormHisId/${formHisId}`,
//     method: "get"
//   });
// };

/**
 * 获取流程模型实例数据
 * @param { string } instanceId -表单实例ID
 */
export const processInstanceForm = instanceId => {
  return request({
    url: `/process/form/data/by/${instanceId}`,
    method: "get"
  });
};

/**
 * 待办获取指派时间的下个任务
 * @param { string } stageTaskId -阶段任务ID
 */
export const toDoNextTask = stageTaskId => {
  return request({
    url: `crm/build/task/toDoNextTask/${stageTaskId}`,
    method: "get"
  });
};
